#coding:utf-8
"""Copyright (c) 2022 God Forever
Online-class Efficiency Optimizer is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
         http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details."""
from multiprocessing import Process,Queue
import psutil
import os
import time
from tkinter.messagebox import *
import win32api
from win32process import *
import keyboard
from win32gui import *
import sys
def getFileDescription(windows_exe):
    try:
        language, codepage = win32api.GetFileVersionInfo(windows_exe, '\\VarFileInfo\\Translation')[0]
        stringFileInfo = u'\\StringFileInfo\\%04X%04X\\%s' % (language, codepage, "FileDescription")
        description = win32api.GetFileVersionInfo(windows_exe, stringFileInfo)
    except:
        description = "unknown"
    return description


def Name(i):
    try:
        return (getFileDescription(i.exe()))
    except:
        return ("unknown")
while True:
    aa = open("killer.txt", "a")
    aa.close()
    try:
        aa = open("killer.txt", "r")
        a2 = aa.readlines()
    except:
        aa = open("killer.txt", "r", encoding="utf-8")
        a2 = aa.readlines()
    for i in range(len(a2)):
        try:
            a2[i] = a2[i].replace("\n", "")
        except:
            if False:
                print()
    while True:
        try:
            a2.remove("")
        except:
            break
    aa.close()
    a = a2
    do = []
    for i in psutil.process_iter():
        for j in a:
            if i.name().lower() == j.lower() or i.name()[:i.name().find(".")].lower() == j.lower() or j.lower() == str(
                    Name(i)).lower():
                if True:
                    if not i.name() in do:
                        willdo = "do.append(i.name())"
                    try:
                        i.kill()
                        exec(willdo)
                    except:
                        if False:
                            print()
                    willdo = ""
    time.sleep(0.5)